/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DummyJavaFXCode;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.openide.util.Exceptions;

/**
 *
 * @author Admin
 */
public class DummyConstantCodeGenerator {
    private String beginLocation = "DummyJavaFXCode/dummyBegin";
    private String endLocation = "DummyJavaFXCode/dummyEnd";
    
    private String readFile(String location) throws IOException{
        BufferedReader inputStream = null;
        StringBuilder sb = new StringBuilder();
        try {
            ClassLoader cl = this.getClass().getClassLoader();
            inputStream =  new BufferedReader(new InputStreamReader(cl.getResourceAsStream(location)));
            
            String temp;
            while(true){
                temp=inputStream.readLine();
                if(temp==null) break;
                else sb.append(temp+"\n");
            }
            
        } catch (FileNotFoundException ex) {
            Exceptions.printStackTrace(ex);
        }
        finally{
            inputStream.close();
            
        }
        return sb.toString();
    }
    public String generateBegin() throws IOException{
        return this.readFile(beginLocation);
    }
    public String generateEnd() throws IOException{
        return this.readFile(endLocation);
    }
}
